package org.example.joinblog.common.enums;

import lombok.Getter;

/**
 * @author clt
 */
@Getter
public enum MessageEnum {
    /**
     * 公告
     */
    ANNOUNCEMENT(0, "公告"),

    /**
     * 点赞
     */
    LIKE(1, "点赞"),
    /**
     * 评论
     */
    COMMENT(2, "评论");


    private final Integer code;
    private final String message;

    MessageEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getMessageByCode(Integer code) {
        for (MessageEnum messageCode : MessageEnum.values()) {
            if (messageCode.getCode().equals(code)) {
                return messageCode.getMessage();
            }
        }
        return null;
    }
}
